<!DOCTYPE HTML>
<html>
<head>
<title>后台登录</title>
<!-- Custom Theme files -->
<link href="css/admin_login.css" rel="stylesheet" type="text/css"
    media="all" />
<!-- Custom Theme files -->
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="后台登录" />

<link rel="stylesheet" type="text/css" href="ui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="ui/themes/icon.css">
<script type="text/javascript" src="ui/jquery.min.js"></script>
<script type="text/javascript" src="ui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="ui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="ui/jquery.serializejson.min.js"></script>

<script>
    function login() {
        //获取表单数据
        var formData = $('#loginForm').serializeJSON();
        //异步请求
        $.ajax({
            url: "admin_login",
            type:'post',
            data: JSON.stringify(formData),
            contentType : "application/json", 
            dataType:'json',
            success:function(value){
                if(value.success) {
                    //登录成功
                    location.href = "adminIndex.html";
                } else {
                    //登录失败
                    $.messager.alert('提示',value.data, "info");
                }
            }
        });
    }
</script>

</head>
<body>
    <div class="login-form">
        <div class="top-login">
            <span><img src="images/group.png" alt="" /></span>
        </div>
        <h1>登录</h1>
        <div class="login-top">
            <form id="loginForm">
                <div class="login-ic">
                    <!-- <i></i>  -->
                    <input type="text" name="username" value="用户名"
                        onFocus="if (this.value == '用户名') {this.value = '';}"
                        onBlur="if (this.value == '') {this.value = '用户名';}" />
                    <div class="clear"></div>
                </div>
                <div class="login-ic">
                    <!-- <i class="icon"></i>  -->
                    <input type="password" name="password" value="password"
                        onFocus="if (this.value == 'password') {this.value = '';}"
                        onBlur="if (this.value == '') {this.value = 'password';}" />
                    <div class="clear"></div>
                </div>

                <div class="log-bwn">
                    <input type="button" onclick="login();" value="Login">
                </div>
            </form>
        </div>
    </div>
</body>
</html>